﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DocumentsTagger.DM
{
    public static class TagsFactory
    {
        private static readonly Dictionary<string, Tag> sr_Documents = new Dictionary<string, Tag>();

        public static List<Tag> Tags { get {return sr_Documents.Values.ToList();} }

        public static Tag GetTag(string Name)
        {
            Tag tag = null;

            if (sr_Documents.ContainsKey(Name.ToLower()))
            {
                tag = sr_Documents[Name.ToLower()];
            }
            else
            {
                tag = new Tag(Name);
                sr_Documents.Add(Name.ToLower(), tag);
            }

            return tag;
        }
    }
}
